<template>
  <a-form
    :form="form"
    :label-col="{ span: 5 }"
    :wrapper-col="{ span: 12 }"
    @submit="handleSubmit"
  >
    <a-row>
      <a-col :span="12">
        <a-form-item label="入学时间">
          <a-date-picker
            style="width: 100%"
            :format="dateFormat"
            v-decorator="[
              'time',
              {
                rules: [{ required: true, message: '请选择日期!' }],
              },
            ]"
          />
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item label="毕业日期">
          <a-date-picker
            style="width: 100%"
            :format="dateFormat"
            v-decorator="[
              'time',
              {
                rules: [{ required: true, message: '请选择日期!' }],
              },
            ]"
          />
        </a-form-item>
      </a-col>
    </a-row>
    <a-row>
      <a-col :span="12">
        <a-form-item label="学习方式">
          <a-select
            v-decorator="[
              'gender',
              {
                rules: [
                  { required: false, message: 'Please select your gender!' },
                ],
              },
            ]"
          >
            <a-select-option value="male"> male </a-select-option>
            <a-select-option value="female"> female </a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item label="学历">
          <a-select
            v-decorator="[
              'gender',
              {
                rules: [
                  { required: false, message: 'Please select your gender!' },
                ],
              },
            ]"
          >
            <a-select-option value="male"> male </a-select-option>
            <a-select-option value="female"> female </a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
    </a-row>
    <a-row>
      <a-col :span="12">
        <a-form-item label="学位">
          <a-select
            v-decorator="[
              'gender',
              {
                rules: [
                  { required: false, message: 'Please select your gender!' },
                ],
              },
            ]"
          >
            <a-select-option value="male"> male </a-select-option>
            <a-select-option value="female"> female </a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item label="学校名称">
          <a-select
            v-decorator="[
              'gender',
              {
                rules: [
                  { required: false, message: 'Please select your gender!' },
                ],
              },
            ]"
          >
            <a-select-option value="male"> male </a-select-option>
            <a-select-option value="female"> female </a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
    </a-row>
    <a-row>
      <a-col :span="12">
        <a-form-item label="专业">
          <a-input
            placeholder="请输入"
            v-decorator="[
              'note',
              {
                rules: [{ required: false, message: '请输入!' }],
              },
            ]"
          />
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item label="学位证书编号">
          <a-input
            placeholder="请输入"
            v-decorator="[
              'note',
              {
                rules: [{ required: false, message: '请输入!' }],
              },
            ]"
          />
        </a-form-item>
      </a-col>
    </a-row>
    <a-row>
      <a-col :span="12">
        <a-form-item label="学历证书编号">
          <a-input
            v-decorator="[
              'note',
              {
                rules: [{ required: false, message: '请输入!' }],
              },
            ]"
            placeholder="请输入"
          />
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item label="提拔方式">
          <a-input
            placeholder="请输入"
            v-decorator="[
              'note',
              {
                rules: [{ required: false, message: '请输入!' }],
              },
            ]"
          />
        </a-form-item>
      </a-col>
    </a-row>

    <a-form-item :wrapper-col="{ span: 12, offset: 5 }">
      <a-button type="primary" html-type="submit"> Submit </a-button>
    </a-form-item>
  </a-form>
</template>

<script>
import moment from 'moment'
export default {
  data () {
    return {
      dateFormat: 'YYYY/MM/DD',
      formLayout: 'horizontal',
      form: this.$form.createForm(this, { name: 'coordinated' }),
    }
  },
  methods: {
    moment,
    handleSubmit (e) {
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
          console.log('Received values of form: ', values)
          alert('提交成功')
        }
      })
    }
  },
  mounted () {
    this.form.setFieldsValue({
      note: `我是默认值`,
      gender: '默认值',
      time: moment('2015/01/09')
    })
  }
};
</script>